NASA OSST proposal exploration¶
%matplotlib inline
%load_ext autoreload
%load_ext watermark
import cf_xarray as cfxr
import cmocean as cmo
import dask
import dcpy
import distributed
import holoviews as hv
import hvplot.xarray
import matplotlib as mpl
import matplotlib.pyplot as plt
import dask_jobqueue
import numpy as np
import pandas as pd
import pump
import xarray as xr
import xgcm
import etpac
mpl.rcParams["savefig.dpi"] = 300
mpl.rcParams["savefig.bbox"] = "tight"
mpl.rcParams["figure.dpi"] = 180
xr.set_options(keep_attrs=True)
hv.output(widget_location="bottom", size=120, dpi=140)
%watermark -iv
The autoreload extension is already loaded. To reload it, use:
%reload_ext autoreload
distributed : 2.30.0
matplotlib : 3.3.2
numpy : 1.19.2
xgcm : 0.5.1.dev91+g86c9641
pump : 0.1
pandas : 1.1.3
hvplot : 0.7.2
cmocean : 2.0
cf_xarray : 0.4.1.dev31+g7a8c620
dask : 2.30.0
xarray : 0.16.3.dev150+g37522e991
dask_jobqueue: 0.7.1
holoviews : 1.14.4
dcpy : 0.1
if "client" in locals():
client.close()
# if "cluster" in locals():
# cluster.close()
env = {"OMP_NUM_THREADS": "3", "NUMBA_NUM_THREADS": "3"}
# cluster = distributed.LocalCluster(
# n_workers=8,
# threads_per_worker=1,
# env=env
# )
if "cluster" in locals():
del cluster
cluster = ncar_jobqueue.NCARCluster(
project="NCGD0048",
scheduler_options=dict(dashboard_address=":9797"),
walltime="03:00:00",
)
# cluster = dask_jobqueue.PBSCluster(
# cores=9, processes=9, memory="108GB", walltime="02:00:00", project="NCGD0043",
# env_extra=env,
# )
cluster.scale(4)
client = distributed.Client(cluster)
cluster = dask_jobqueue.PBSCluster(
cores=1, # The number of cores you want
memory="10GB", # Amount of memory
processes=1, # How many processes
queue="casper", # The type of queue to utilize (/glade/u/apps/dav/opt/usr/bin/execcasper)
local_directory="$TMPDIR", # Use your local directory
resource_spec="select=1:ncpus=1:mem=10GB", # Specify resources
project="ncgd0048", # Input your project ID here
walltime="02:00:00", # Amount of wall time
interface="ib0", # Interface to use
)
cluster.scale(4)
client = distributed.Client(cluster)
client
Client
|
Cluster
|
Read data¶
bytrack = xr.load_dataset("long-eddy-tracks.nc")
bytrack["longitude"] = bytrack["longitude"] - 360
bytrack["lon0"] = bytrack.lon0 - 360
topo = (
xr.open_dataset("/glade/u/home/dcherian/datasets/ETOPO2v2g_f4.nc4")
.z.sel(x=slice(-150, -75), y=slice(-10, 20))
.load()
)
#topo["x"] = topo.x + 360
topo
<xarray.DataArray 'z' (y: 901, x: 2251)>
array([[-4120., -3794., -3244., ..., 252., 240., 200.],
[-3893., -3416., -2694., ..., 193., 189., 195.],
[-3711., -3246., -2461., ..., 206., 185., 192.],
...,
[-5320., -5310., -5302., ..., 97., 156., 164.],
[-5326., -5318., -5312., ..., 122., 212., 145.],
[-5328., -5352., -5348., ..., 106., 157., 87.]],
dtype=float32)
Coordinates:
* x (x) float32 -150.0 -150.0 -149.9 -149.9 ... -75.07 -75.03 -75.0
* y (y) float32 -10.0 -9.967 -9.933 -9.9 ... 19.9 19.93 19.97 20.0
Attributes:
long_name: z
actual_range: [-10722. 8046.]- y: 901
- x: 2251
- -4.12e+03 -3.794e+03 -3.244e+03 -2.957e+03 ... 8.0 106.0 157.0 87.0
array([[-4120., -3794., -3244., ..., 252., 240., 200.], [-3893., -3416., -2694., ..., 193., 189., 195.], [-3711., -3246., -2461., ..., 206., 185., 192.], ..., [-5320., -5310., -5302., ..., 97., 156., 164.], [-5326., -5318., -5312., ..., 122., 212., 145.], [-5328., -5352., -5348., ..., 106., 157., 87.]], dtype=float32) - x(x)float32-150.0 -150.0 ... -75.03 -75.0
- long_name :
- x
- actual_range :
- [-180. 180.]
array([-150. , -149.96666 , -149.93333 , ..., -75.066666, -75.03333 , -75. ], dtype=float32) - y(y)float32-10.0 -9.967 -9.933 ... 19.97 20.0
- long_name :
- y
- actual_range :
- [-90. 90.]
array([-10. , -9.966666, -9.933333, ..., 19.933332, 19.966667, 20. ], dtype=float32)
- long_name :
- z
- actual_range :
- [-10722. 8046.]
sss = xr.open_dataset(
"/glade/work/dcherian/datasets/oisss_merged.zarr",
engine="zarr",
consolidated=True,
chunks="auto",
)
sss
/glade/u/home/dcherian/python/xarray/xarray/coding/times.py:119: SerializationWarning: Ambiguous reference date string: 1-1-1 00:00:0.0. The first value is assumed to be the year hence will be padded with zeros to remove the ambiguity (the padded reference date string is: 0001-1-1 00:00:0.0). To remove this message, remove the ambiguity by padding your reference date strings with zeros.
warnings.warn(warning_msg, SerializationWarning)
<xarray.Dataset>
Dimensions: (lat: 720, lon: 1440, time: 872)
Coordinates:
* lat (lat) float64 -89.88 -89.62 -89.38 ... 89.38 89.62 89.88
* lon (lon) float64 -179.9 -179.6 -179.4 ... 179.4 179.6 179.9
* time (time) datetime64[ns] 2011-08-28 2011-09-01 ... 2021-03-12
Data variables:
sss (time, lat, lon) float32 dask.array<chunksize=(30, 720, 1440), meta=np.ndarray>
sss_uncertainty (time, lat, lon) float32 dask.array<chunksize=(30, 720, 1440), meta=np.ndarray>
Attributes:
Conventions: COARDS\nGrADS
dataType: Grid
documentation: http://apdrc.soest.hawaii.edu/datadoc/oisss_multi.php
history: Thu Jul 01 10:54:37 HST 2021 : imported by GrADS Data Ser...
title: Multi-Mission OISSS 7-Day Global Dataset V1.0- lat: 720
- lon: 1440
- time: 872
- lat(lat)float64-89.88 -89.62 ... 89.62 89.88
- grads_dim :
- y
- grads_mapping :
- linear
- grads_size :
- 720
- long_name :
- latitude
- maximum :
- 89.875
- minimum :
- -89.875
- resolution :
- 0.25
- units :
- degrees_north
array([-89.875, -89.625, -89.375, ..., 89.375, 89.625, 89.875])
- lon(lon)float64-179.9 -179.6 ... 179.6 179.9
- grads_dim :
- x
- grads_mapping :
- linear
- grads_size :
- 1440
- long_name :
- longitude
- maximum :
- 179.875
- minimum :
- -179.875
- resolution :
- 0.25
- units :
- degrees_east
array([-179.875, -179.625, -179.375, ..., 179.375, 179.625, 179.875])
- time(time)datetime64[ns]2011-08-28 ... 2021-03-12
- grads_dim :
- t
- grads_mapping :
- linear
- grads_min :
- 00z28aug2011
- grads_size :
- 872
- grads_step :
- 4dy
- long_name :
- time
- maximum :
- 00z12mar2021
- minimum :
- 00z28aug2011
- resolution :
- 4.0
array(['2011-08-28T00:00:00.000000000', '2011-09-01T00:00:00.000000000', '2011-09-05T00:00:00.000000000', ..., '2021-03-04T00:00:00.000000000', '2021-03-08T00:00:00.000000000', '2021-03-12T00:00:00.000000000'], dtype='datetime64[ns]')
- sss(time, lat, lon)float32dask.array<chunksize=(30, 720, 1440), meta=np.ndarray>
- long_name :
- sea surface salinity [1e-3]
Array Chunk Bytes 3.62 GB 124.42 MB Shape (872, 720, 1440) (30, 720, 1440) Count 31 Tasks 30 Chunks Type float32 numpy.ndarray - sss_uncertainty(time, lat, lon)float32dask.array<chunksize=(30, 720, 1440), meta=np.ndarray>
- long_name :
- estimated empirical uncertainty of multi-mission oisss [1e-3]
Array Chunk Bytes 3.62 GB 124.42 MB Shape (872, 720, 1440) (30, 720, 1440) Count 31 Tasks 30 Chunks Type float32 numpy.ndarray
- Conventions :
- COARDS GrADS
- dataType :
- Grid
- documentation :
- http://apdrc.soest.hawaii.edu/datadoc/oisss_multi.php
- history :
- Thu Jul 01 10:54:37 HST 2021 : imported by GrADS Data Server 2.0
- title :
- Multi-Mission OISSS 7-Day Global Dataset V1.0
region = dict(latitude=slice(-5, 30), longitude=slice(-180, -70))
mimocml = dcpy.oceans.read_mimoc()
mimocml["longitude"] = mimocml.longitude - 360
mimocml = mimocml.cf.sel(region)
mimocml
<xarray.Dataset>
Dimensions: (latitude: 71, longitude: 221, time: 12)
Coordinates:
* latitude (latitude) float32 -5.0 -4.5 ... 30.0
* longitude (longitude) float32 -180.0 ... -70.0
* time (time) datetime64[ns] 2014-01-15 ... 2...
Data variables:
SALINITY_MIXED_LAYER (time, latitude, longitude) float32 dask.array<chunksize=(1, 71, 221), meta=np.ndarray>
POTENTIAL_TEMPERATURE_MIXED_LAYER (time, latitude, longitude) float32 dask.array<chunksize=(1, 71, 221), meta=np.ndarray>
DEPTH_MIXED_LAYER (time, latitude, longitude) float32 dask.array<chunksize=(1, 71, 221), meta=np.ndarray>- latitude: 71
- longitude: 221
- time: 12
- latitude(latitude)float32-5.0 -4.5 -4.0 ... 29.0 29.5 30.0
- units :
- degrees_north
- axis :
- Y
array([-5. , -4.5, -4. , -3.5, -3. , -2.5, -2. , -1.5, -1. , -0.5, 0. , 0.5, 1. , 1.5, 2. , 2.5, 3. , 3.5, 4. , 4.5, 5. , 5.5, 6. , 6.5, 7. , 7.5, 8. , 8.5, 9. , 9.5, 10. , 10.5, 11. , 11.5, 12. , 12.5, 13. , 13.5, 14. , 14.5, 15. , 15.5, 16. , 16.5, 17. , 17.5, 18. , 18.5, 19. , 19.5, 20. , 20.5, 21. , 21.5, 22. , 22.5, 23. , 23.5, 24. , 24.5, 25. , 25.5, 26. , 26.5, 27. , 27.5, 28. , 28.5, 29. , 29.5, 30. ], dtype=float32) - longitude(longitude)float32-180.0 -179.5 ... -70.5 -70.0
- units :
- degrees_east
- axis :
- X
array([-180. , -179.5, -179. , ..., -71. , -70.5, -70. ], dtype=float32)
- time(time)datetime64[ns]2014-01-15 ... 2014-12-15
array(['2014-01-15T00:00:00.000000000', '2014-02-15T00:00:00.000000000', '2014-03-15T00:00:00.000000000', '2014-04-15T00:00:00.000000000', '2014-05-15T00:00:00.000000000', '2014-06-15T00:00:00.000000000', '2014-07-15T00:00:00.000000000', '2014-08-15T00:00:00.000000000', '2014-09-15T00:00:00.000000000', '2014-10-15T00:00:00.000000000', '2014-11-15T00:00:00.000000000', '2014-12-15T00:00:00.000000000'], dtype='datetime64[ns]')
- SALINITY_MIXED_LAYER(time, latitude, longitude)float32dask.array<chunksize=(1, 71, 221), meta=np.ndarray>
Array Chunk Bytes 753.17 kB 62.76 kB Shape (12, 71, 221) (1, 71, 221) Count 60 Tasks 12 Chunks Type float32 numpy.ndarray - POTENTIAL_TEMPERATURE_MIXED_LAYER(time, latitude, longitude)float32dask.array<chunksize=(1, 71, 221), meta=np.ndarray>
Array Chunk Bytes 753.17 kB 62.76 kB Shape (12, 71, 221) (1, 71, 221) Count 60 Tasks 12 Chunks Type float32 numpy.ndarray - DEPTH_MIXED_LAYER(time, latitude, longitude)float32dask.array<chunksize=(1, 71, 221), meta=np.ndarray>
Array Chunk Bytes 753.17 kB 62.76 kB Shape (12, 71, 221) (1, 71, 221) Count 60 Tasks 12 Chunks Type float32 numpy.ndarray
MIMOC MLS¶
mimocml.SALINITY_MIXED_LAYER.plot.contour(
levels=[32, 33, 33.5, 34], col="time", col_wrap=4, aspect=1.6
)
<xarray.plot.facetgrid.FacetGrid at 0x2b3ed20e5100>
SSS merged¶
sss_clim = sss.groupby("time.month").mean().cf.sel(region).load().sss
sss_clim.plot.contour(levels=[32, 33, 33.5, 34], col="month", col_wrap=4, aspect=1.6)
<xarray.plot.facetgrid.FacetGrid at 0x2b3ed9b8a4f0>
MIMOC MLS vs SSS¶
This figure tries to figure out how well the climatological SSS contours line up with climatological ML salinity contours.
In red is the S=34 contour from the merged SSS product (2011-2021, 4 day).
In black dashed are [34, 34.1, 34.2] contours for MIMOC mixed layer salinity.
To within 0.2 psu; the S=34 contour at the surface is a reasonable approximation of S at the mixed layer base (climatologically)
fg = mimocml.SALINITY_MIXED_LAYER.plot.contour(
levels=[34, 34.1, 34.2],
linestyles="--",
colors="k",
col="time",
col_wrap=4,
aspect=1.6,
)
for idx, ax in enumerate(fg.axes.flat):
sss_clim.isel(month=idx).plot.contour(
levels=[34], colors="r", ax=ax, add_labels=False
)
SSS contours¶
Visualizes each 4-day mean contour in a month with the monthly mean SSS contour.
sss_avg = (
sss.sss.cf.sel(region)
# 1°x1° average for smoothing
.cf.coarsen(latitude=4, longitude=4)
.mean()
.load()
)
sss_monthly = sss_avg.groupby("time.month")
There seems to be a lot of zonal extension except during MAM
Long-lived eddies don’t seem to exit the mean S=34 contour (red:tehuantepec, blue: papagayo, green: oce; Hasson et al 2019).
enso_labels = pump.make_enso_mask().reindex(time=sss_avg.time, method="nearest")
enso_monthly_mean_sss = dask_groupby.xarray.xarray_reduce(
sss_avg, enso_labels, sss_avg.time.dt.month, func="mean", fill_value=np.nan
)
def plot_eddy_tracks_in_month(bytrack, month, ax=None):
if ax is not None:
plt.sca(ax)
for kind, crit in etpac.eddy_kinds.items():
color = crit["color"]
subset = bytrack.query({"track": f"kind == {kind!r}"})
# etpac.plot_tracks(subset, kind=kind, color=color, lw=0.1)
etpac.plot_tracks(
subset.where(subset.time.dt.month == month, drop=True),
kind=kind,
color=color,
lw=1,
initial=False,
)
f, ax = plt.subplots(3, 4, sharex=True, sharey=True, constrained_layout=True)
for ax, (month, group) in zip(ax.flat, sss_monthly):
group = group.cf.sel(latitude=slice(20))
for t in range(group.sizes["time"]):
group.isel(time=t).plot.contour(
ax=ax,
levels=[34],
linewidths=0.4,
colors="black",
alpha=0.1,
add_labels=False,
)
group.mean("time").plot.contour(
ax=ax, levels=[34], linewidths=1.5, colors="k", add_labels=False
)
plot_eddy_tracks_in_month(bytrack, month=month, ax=ax)
topo.sel(x=slice(-110, -70), y=slice(-5, 20)).plot.contour(
levels=[0, 2000, 4000], linewidths=0.75, ax=ax, add_labels=False
)
ax.set_title(f"month={month}, ncontours={group.sizes['time']}")
f.set_size_inches((11, 6))
ENSO phase-averaged SSS=34¶
Mean SSS=34 for ENSO phases. Note there are no observations for La-Nina Apr-Jul; and the mean mostly reflects Neutral state
enso_labels.groupby("time.month").map(lambda g: g.groupby(g).count())
<xarray.DataArray 'enso_phase' (month: 12, enso_phase: 3)>
array([[ 8., 15., 55.],
[ 7., 11., 52.],
[16., 4., 53.],
[27., nan, 41.],
[31., nan, 38.],
[30., nan, 38.],
[27., nan, 43.],
[19., 5., 46.],
[10., 16., 50.],
[ 8., 15., 55.],
[ 7., 15., 52.],
[ 8., 16., 54.]])
Coordinates:
* enso_phase (enso_phase) object 'El-Nino' 'La-Nina' 'Neutral'
* month (month) int64 1 2 3 4 5 6 7 8 9 10 11 12
Attributes:
description: ENSO phase; El-Nino = NINO34 SSTA > 0.4 for at least 6 mont...- month: 12
- enso_phase: 3
- 8.0 15.0 55.0 7.0 11.0 52.0 16.0 ... 55.0 7.0 15.0 52.0 8.0 16.0 54.0
array([[ 8., 15., 55.], [ 7., 11., 52.], [16., 4., 53.], [27., nan, 41.], [31., nan, 38.], [30., nan, 38.], [27., nan, 43.], [19., 5., 46.], [10., 16., 50.], [ 8., 15., 55.], [ 7., 15., 52.], [ 8., 16., 54.]]) - enso_phase(enso_phase)object'El-Nino' 'La-Nina' 'Neutral'
array(['El-Nino', 'La-Nina', 'Neutral'], dtype=object)
- month(month)int641 2 3 4 5 6 7 8 9 10 11 12
array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
- description :
- ENSO phase; El-Nino = NINO34 SSTA > 0.4 for at least 6 months; La-Nina = NINO34 SSTA < -0.4 for at least 6 months
Monthly mean S=34 partitioned by ENSO phase: {“Neutral”: “sienna”, “El-Nino”: “orangered”, “La-Nina”: “navy”}. Full-time mean in thick black
enso_colors = {"Neutral": "sienna", "El-Nino": "orangered", "La-Nina": "navy"}
f, ax = plt.subplots(3, 4, sharex=True, sharey=True, constrained_layout=True)
for ax, (month, group) in zip(ax.flat, sss_monthly):
group = group.cf.sel(latitude=slice(20))
group.mean("time").plot.contour(
ax=ax, levels=[34], linewidths=1.5, colors="k", add_labels=False
)
for phase in enso_monthly_mean_sss.enso_phase.data:
enso_monthly_mean_sss.cf.sel(
latitude=slice(20), month=month, enso_phase=phase
).cf.plot.contour(
ax=ax,
levels=[34],
linewidths=1,
linestyles="--",
colors=enso_colors[phase],
add_labels=False,
)
topo.sel(x=slice(-110, -70), y=slice(-5, 20)).plot.contour(
levels=[0, 2000, 4000], linewidths=0.75, ax=ax, add_labels=False
)
ax.set_title(f"month={month}, ncontours={group.sizes['time']}")
f.set_size_inches((11, 6))
/glade/u/home/dcherian/miniconda3/envs/dcpy/lib/python3.8/site-packages/matplotlib/contour.py:1494: UserWarning: Warning: converting a masked element to nan.
self.zmax = float(z.max())
/glade/u/home/dcherian/miniconda3/envs/dcpy/lib/python3.8/site-packages/matplotlib/contour.py:1495: UserWarning: Warning: converting a masked element to nan.
self.zmin = float(z.min())
/glade/u/home/dcherian/python/xarray/xarray/plot/plot.py:995: UserWarning: No contour levels were found within the data range.
primitive = ax.contour(x, y, z, **kwargs)
/glade/u/home/dcherian/miniconda3/envs/dcpy/lib/python3.8/site-packages/matplotlib/contour.py:1494: UserWarning: Warning: converting a masked element to nan.
self.zmax = float(z.max())
/glade/u/home/dcherian/miniconda3/envs/dcpy/lib/python3.8/site-packages/matplotlib/contour.py:1495: UserWarning: Warning: converting a masked element to nan.
self.zmin = float(z.min())
/glade/u/home/dcherian/python/xarray/xarray/plot/plot.py:995: UserWarning: No contour levels were found within the data range.
primitive = ax.contour(x, y, z, **kwargs)
/glade/u/home/dcherian/miniconda3/envs/dcpy/lib/python3.8/site-packages/matplotlib/contour.py:1494: UserWarning: Warning: converting a masked element to nan.
self.zmax = float(z.max())
/glade/u/home/dcherian/miniconda3/envs/dcpy/lib/python3.8/site-packages/matplotlib/contour.py:1495: UserWarning: Warning: converting a masked element to nan.
self.zmin = float(z.min())
/glade/u/home/dcherian/python/xarray/xarray/plot/plot.py:995: UserWarning: No contour levels were found within the data range.
primitive = ax.contour(x, y, z, **kwargs)
/glade/u/home/dcherian/miniconda3/envs/dcpy/lib/python3.8/site-packages/matplotlib/contour.py:1494: UserWarning: Warning: converting a masked element to nan.
self.zmax = float(z.max())
/glade/u/home/dcherian/miniconda3/envs/dcpy/lib/python3.8/site-packages/matplotlib/contour.py:1495: UserWarning: Warning: converting a masked element to nan.
self.zmin = float(z.min())
/glade/u/home/dcherian/python/xarray/xarray/plot/plot.py:995: UserWarning: No contour levels were found within the data range.
primitive = ax.contour(x, y, z, **kwargs)
Long-lived eddy tracks¶
handles = []
for kind, crit in etpac.eddy_kinds.items():
color = crit["color"]
if kind == "all":
continue
masked = bytrack.query({"track": f"kind == {kind!r}"})
hdl = etpac.plot_tracks(masked, kind=kind, color=color)
print(kind)
if hdl:
handles.append(hdl[0])
topo_subset = topo.sel(x=slice(-110, -80), y=slice(5, 18))
#topo_subset["x"] = topo_subset.x + 360
topo_subset.plot.contour(
levels=[0, 500, 1000, 2000, 3000, 4000], ax=plt.gca(), linewidths=0.3
)
plt.legend(handles=handles)
plt.xlim(None, -80)
plt.ylim(3, 18)
plt.gca().set_aspect(2)
teh
pap
oce
Process Chelton eddy tracks¶
Pulling out “long lived” eddy tracks following Hasson et al (2019)
tracks = xr.open_dataset(
"/glade/u/home/dcherian/datasets/aviso-eddies/eddy_trajectory_2.0exp_19930101_20180118.nc"
)
tracks.longitude.load()
<xarray.DataArray 'longitude' (obs: 25871877)>
array([ 19.3175, 19.2417, 19.1798, ..., 256.399 , 256.402 , 256.405 ],
dtype=float32)
Dimensions without coordinates: obs
Attributes:
Longname: longitude of measurement
description: observation longitude
standard_name: longitude
units: degrees_east
min: 0.0
max: 359.99936- obs: 25871877
- 19.32 19.24 19.18 19.12 19.06 18.97 ... 256.4 256.4 256.4 256.4 256.4
array([ 19.3175, 19.2417, 19.1798, ..., 256.399 , 256.402 , 256.405 ], dtype=float32) - Longname :
- longitude of measurement
- description :
- observation longitude
- standard_name :
- longitude
- units :
- degrees_east
- min :
- 0.0
- max :
- 359.99936
subset = tracks.query(
{"obs": "latitude > 3 and latitude < 20 and longitude > 180 and longitude < 360-65"}
)
subset.track.load()
<xarray.DataArray 'track' (obs: 763196)>
array([ 72, 72, 72, ..., 352341, 352341, 352341], dtype=uint32)
Dimensions without coordinates: obs
Attributes:
Longname: track_number
description: eddy identification number
units: ordinal
min: 0
max: 352416- obs: 763196
- 72 72 72 72 72 72 72 ... 352341 352341 352341 352341 352341 352341
array([ 72, 72, 72, ..., 352341, 352341, 352341], dtype=uint32)
- Longname :
- track_number
- description :
- eddy identification number
- units :
- ordinal
- min :
- 0
- max :
- 352416
track_lengths = subset.track.groupby(subset.track).count()
track_lengths.plot.hist(bins=np.arange(0, 500, 10))
(array([4.060e+02, 3.860e+02, 1.147e+03, 3.051e+03, 2.075e+03, 1.417e+03,
1.052e+03, 7.600e+02, 5.590e+02, 4.370e+02, 3.020e+02, 2.650e+02,
2.110e+02, 1.620e+02, 1.400e+02, 1.060e+02, 7.400e+01, 7.100e+01,
4.800e+01, 5.000e+01, 4.400e+01, 3.100e+01, 2.100e+01, 2.100e+01,
1.700e+01, 1.400e+01, 1.400e+01, 1.000e+01, 7.000e+00, 2.000e+00,
1.000e+00, 5.000e+00, 0.000e+00, 3.000e+00, 3.000e+00, 3.000e+00,
2.000e+00, 1.000e+00, 0.000e+00, 3.000e+00, 1.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 1.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00]),
array([ 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120,
130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250,
260, 270, 280, 290, 300, 310, 320, 330, 340, 350, 360, 370, 380,
390, 400, 410, 420, 430, 440, 450, 460, 470, 480, 490]),
<BarContainer object of 49 artists>)
long_tracks = track_lengths.where(track_lengths > 30, drop=True).track.data
indexer = subset.track.isin(long_tracks).data
long_track_data = subset.sel(obs=indexer)[
["amplitude", "time", "track", "speed_radius", "latitude", "longitude"]
].load()
grouped = long_track_data.groupby("track")
datasets = [
group.assign_coords(obs=np.arange(group.sizes["obs"]), track=group.track.data[0])
for _, group in grouped
]
bytrack = xr.concat(datasets, dim="track").rename({"obs": "itime"}).drop_vars("itime")
bytrack.coords["lat0"] = bytrack.latitude.isel(itime=0)
bytrack.coords["lon0"] = bytrack.longitude.isel(itime=0)
plt.plot(bytrack.lon0, bytrack.lat0, '.')
[<matplotlib.lines.Line2D at 0x2adf68245190>]
bytrack.coords["kind"] = xr.full_like(bytrack.lon0, dtype="U3", fill_value="all")
for name, crit in etpac.eddy_kinds.items():
mask = (
(bytrack.lat0.data < crit["lat0"][1])
& (bytrack.lat0.data > crit["lat0"][0])
& (bytrack.lon0.data < crit["lon0"][1])
& (bytrack.lon0.data > crit["lon0"][0])
& (bytrack.amplitude > 20).any("itime")
& (bytrack.speed_radius > 100).any("itime")
)
#print(name, np.sum(mask).data)
bytrack.kind.data[mask] = name
import cftime
bytrack["time"] = bytrack.time.fillna(cftime.DatetimeJulian(1993, 1, 1, 0, 0, 0, 0))
bytrack.to_netcdf("long-eddy-tracks.nc")
<ipython-input-235-5c2f888bf50d>:1: SerializationWarning: saving variable speed_radius with floating point data as an integer dtype without any _FillValue to use for NaNs
bytrack.to_netcdf("long-eddy-tracks.nc")
ETPac MOM6 and obs videos¶
dirname = "/glade/p/nsc/ncgd0048/ETP_1_20/"
daily = f"{dirname}/COMPRESSED_OCEAN_DAILY/ocean_daily__201*.nc"
hourly = f"{dirname}/COMPRESSED_OCEAN_HOURLY/ocean_hourly__201*.nc"
cluster.scale(12)
dshour = xr.open_mfdataset(
hourly, coords="minimal", compat="override", data_vars=["ssh"], parallel=True
)
dshour = dshour.coarsen(time=24).mean()
dshour["time"] = dshour.time.dt.floor("H")
ds = xr.open_mfdataset(
daily, data_vars="minimal", coords="minimal", compat="override", parallel=True
)
geometry = xr.open_dataset(f"{dirname}/rundir/ETP.012/run/ocean_geometry.nc").rename(
{"lath": "yh", "lonh": "xh", "latq": "yq", "lonq": "xq"}
)
ds = ds.cf.guess_coord_axis()
ds.coords.update(geometry)
def xgcm_grid_mom6(geometry):
import xgcm
grid = xgcm.Grid(
geometry,
coords={
"X": {"center": "xh", "outer": "xq"},
"Y": {"center": "yh", "outer": "yq"},
"Z": {"inner": "z_l", "outer": "z_i"},
},
periodic=False,
metrics={
("X",): ["dxT", "dxCu", "dxCv", "dxBu"], # X distances
("Y",): ["dyT", "dyCu", "dyCv", "dyBu"], # Y distances
# ("Z",): ["drW", "drS", "drC"], # Z distances
("X", "Y"): ["Ah", "Aq"], # Areas
},
boundary={"X": "extend", "Y": "extend", "Z": "extend"},
)
grid.arakawa = "C"
return grid
xr.align(ds, dshour, join="exact")
ds.update(dshour)
ds["xh"] = ds.xh - 360
ds["xq"] = ds.xq - 360
mean_ssh = ds["ssh"].mean("time").compute()
ds["ssha"] = ds.ssh - mean_ssh
ds.so.attrs["standard_name"] = "sea_surface_salinity"
ds.ssha.attrs["standard_name"] = "sea_surface_height_anomaly"
ds.D.attrs["standard_name"] = "water_depth"
ds
<xarray.Dataset>
Dimensions: (xh: 1000, yh: 900, zl: 140, time: 3287, nv: 2, xq: 1001, yq: 901)
Coordinates: (12/26)
* xh (xh) float64 -125.0 -124.9 -124.9 ... -75.12 -75.07 -75.02
* yh (yh) float64 -14.97 -14.93 -14.88 -14.82 ... 29.88 29.92 29.98
* zl (zl) float64 1.25 3.75 6.25 ... 6.074e+03 6.324e+03 6.475e+03
* time (time) datetime64[ns] 2009-12-30T12:00:00 ... 2018-12-29T12:0...
* nv (nv) float64 1.0 2.0
* xq (xq) float64 -125.0 -124.9 -124.9 -124.8 ... -75.1 -75.05 -75.0
... ...
dyBu (yq, xq) float64 ...
Ah (yh, xh) float64 ...
Aq (yq, xq) float64 ...
dxCvo (yq, xh) float64 ...
dyCuo (yh, xq) float64 ...
wet (yh, xh) float64 ...
Data variables: (12/22)
thetao (time, zl, yh, xh) float32 dask.array<chunksize=(1, 140, 900, 1000), meta=np.ndarray>
so (time, zl, yh, xh) float32 dask.array<chunksize=(1, 140, 900, 1000), meta=np.ndarray>
uo (time, zl, yh, xq) float32 dask.array<chunksize=(1, 140, 900, 1001), meta=np.ndarray>
vo (time, zl, yq, xh) float32 dask.array<chunksize=(1, 140, 901, 1000), meta=np.ndarray>
average_T1 (time) datetime64[ns] dask.array<chunksize=(1,), meta=np.ndarray>
average_T2 (time) datetime64[ns] dask.array<chunksize=(1,), meta=np.ndarray>
... ...
hflso (time, yh, xh) float32 dask.array<chunksize=(1, 900, 1000), meta=np.ndarray>
hfsso (time, yh, xh) float32 dask.array<chunksize=(1, 900, 1000), meta=np.ndarray>
rsntds (time, yh, xh) float32 dask.array<chunksize=(1, 900, 1000), meta=np.ndarray>
hfds (time, yh, xh) float32 dask.array<chunksize=(1, 900, 1000), meta=np.ndarray>
friver (time, yh, xh) float32 dask.array<chunksize=(1, 900, 1000), meta=np.ndarray>
ssha (time, yh, xh) float32 dask.array<chunksize=(1, 900, 1000), meta=np.ndarray>
Attributes:
filename: ocean_daily__2010_001.nc
title: MOM6 diagnostic fields table for CESM case: ETP.003
grid_type: regular
grid_tile: N/A- xh: 1000
- yh: 900
- zl: 140
- time: 3287
- nv: 2
- xq: 1001
- yq: 901
- xh(xh)float64-125.0 -124.9 ... -75.07 -75.02
- long_name :
- h point nominal longitude
- units :
- degrees_east
- cartesian_axis :
- X
array([-124.975, -124.925, -124.875, ..., -75.125, -75.075, -75.025])
- yh(yh)float64-14.97 -14.93 ... 29.92 29.98
- long_name :
- h point nominal latitude
- units :
- degrees_north
- cartesian_axis :
- Y
array([-14.975, -14.925, -14.875, ..., 29.875, 29.925, 29.975])
- zl(zl)float641.25 3.75 ... 6.324e+03 6.475e+03
- axis :
- Z
- long_name :
- Layer pseudo-depth, -z*
- units :
- meter
- cartesian_axis :
- Z
- positive :
- down
array([1.250000e+00, 3.750000e+00, 6.250000e+00, 8.750000e+00, 1.125000e+01, 1.375000e+01, 1.625000e+01, 1.875000e+01, 2.125000e+01, 2.375000e+01, 2.625000e+01, 2.875000e+01, 3.125000e+01, 3.375000e+01, 3.625000e+01, 3.875000e+01, 4.125000e+01, 4.375000e+01, 4.625000e+01, 4.875000e+01, 5.125000e+01, 5.375000e+01, 5.625000e+01, 5.875000e+01, 6.125000e+01, 6.375000e+01, 6.625000e+01, 6.875000e+01, 7.125000e+01, 7.375000e+01, 7.625000e+01, 7.875000e+01, 8.125000e+01, 8.375000e+01, 8.625000e+01, 8.875000e+01, 9.125000e+01, 9.375000e+01, 9.625000e+01, 9.875000e+01, 1.013125e+02, 1.040031e+02, 1.068283e+02, 1.097947e+02, 1.129094e+02, 1.161799e+02, 1.196139e+02, 1.232196e+02, 1.270056e+02, 1.309808e+02, 1.351549e+02, 1.395376e+02, 1.441395e+02, 1.489715e+02, 1.540451e+02, 1.593723e+02, 1.649659e+02, 1.708392e+02, 1.770062e+02, 1.834815e+02, 1.902806e+02, 1.974196e+02, 2.049156e+02, 2.127864e+02, 2.210507e+02, 2.297282e+02, 2.388396e+02, 2.484066e+02, 2.584519e+02, 2.689995e+02, 2.800745e+02, 2.917033e+02, 3.039134e+02, 3.167341e+02, 3.301958e+02, 3.443306e+02, 3.591721e+02, 3.747557e+02, 3.911185e+02, 4.082994e+02, 4.263394e+02, 4.452814e+02, 4.651704e+02, 4.860540e+02, 5.079816e+02, 5.310057e+02, 5.551810e+02, 5.805651e+02, 6.072183e+02, 6.352042e+02, 6.645895e+02, 6.954439e+02, 7.278411e+02, 7.618582e+02, 7.975761e+02, 8.350799e+02, 8.744589e+02, 9.158068e+02, 9.592222e+02, 1.004808e+03, 1.052674e+03, 1.102932e+03, 1.155704e+03, 1.211114e+03, 1.269295e+03, 1.330385e+03, 1.394529e+03, 1.461880e+03, 1.532599e+03, 1.606854e+03, 1.684822e+03, 1.766688e+03, 1.852648e+03, 1.942905e+03, 2.037675e+03, 2.137184e+03, 2.241668e+03, 2.351377e+03, 2.466570e+03, 2.587524e+03, 2.714525e+03, 2.847876e+03, 2.987895e+03, 3.134915e+03, 3.289286e+03, 3.451375e+03, 3.621569e+03, 3.800272e+03, 3.987911e+03, 4.184931e+03, 4.391803e+03, 4.609018e+03, 4.837094e+03, 5.076573e+03, 5.324234e+03, 5.574234e+03, 5.824234e+03, 6.074234e+03, 6.324234e+03, 6.474617e+03]) - time(time)datetime64[ns]2009-12-30T12:00:00 ... 2018-12-...
array(['2009-12-30T12:00:00.000000000', '2009-12-31T12:00:00.000000000', '2010-01-01T12:00:00.000000000', ..., '2018-12-27T12:00:00.000000000', '2018-12-28T12:00:00.000000000', '2018-12-29T12:00:00.000000000'], dtype='datetime64[ns]') - nv(nv)float641.0 2.0
- long_name :
- vertex number
- units :
- none
- cartesian_axis :
- N
array([1., 2.])
- xq(xq)float64-125.0 -124.9 ... -75.05 -75.0
- long_name :
- q point nominal longitude
- units :
- degrees_east
- cartesian_axis :
- X
array([-125. , -124.95, -124.9 , ..., -75.1 , -75.05, -75. ])
- yq(yq)float64-15.0 -14.95 -14.9 ... 29.95 30.0
- long_name :
- q point nominal latitude
- units :
- degrees_north
- cartesian_axis :
- Y
array([-15. , -14.95, -14.9 , ..., 29.9 , 29.95, 30. ])
- geolatb(yq, xq)float64...
- long_name :
- latitude at corner (Bu) points
- units :
- degree
[901901 values with dtype=float64]
- geolonb(yq, xq)float64...
- long_name :
- longitude at corner (Bu) points
- units :
- degree
[901901 values with dtype=float64]
- geolat(yh, xh)float64...
- long_name :
- latitude at tracer (T) points
- units :
- degree
[900000 values with dtype=float64]
- geolon(yh, xh)float64...
- long_name :
- longitude at tracer (T) points
- units :
- degree
[900000 values with dtype=float64]
- D(yh, xh)float64...
- long_name :
- Basin Depth
- units :
- meter
[900000 values with dtype=float64]
- f(yq, xq)float64...
- long_name :
- Coriolis Parameter
- units :
- s-1
[901901 values with dtype=float64]
- dxCv(yq, xh)float64...
- long_name :
- Zonal grid spacing at v points
- units :
- m
[901000 values with dtype=float64]
- dyCu(yh, xq)float64...
- long_name :
- Meridional grid spacing at u points
- units :
- m
[900900 values with dtype=float64]
- dxCu(yh, xq)float64...
- long_name :
- Zonal grid spacing at u points
- units :
- m
[900900 values with dtype=float64]
- dyCv(yq, xh)float64...
- long_name :
- Meridional grid spacing at v points
- units :
- m
[901000 values with dtype=float64]
- dxT(yh, xh)float64...
- long_name :
- Zonal grid spacing at h points
- units :
- m
[900000 values with dtype=float64]
- dyT(yh, xh)float64...
- long_name :
- Meridional grid spacing at h points
- units :
- m
[900000 values with dtype=float64]
- dxBu(yq, xq)float64...
- long_name :
- Zonal grid spacing at q points
- units :
- m
[901901 values with dtype=float64]
- dyBu(yq, xq)float64...
- long_name :
- Meridional grid spacing at q points
- units :
- m
[901901 values with dtype=float64]
- Ah(yh, xh)float64...
- long_name :
- Area of h cells
- units :
- m2
[900000 values with dtype=float64]
- Aq(yq, xq)float64...
- long_name :
- Area of q cells
- units :
- m2
[901901 values with dtype=float64]
- dxCvo(yq, xh)float64...
- long_name :
- Open zonal grid spacing at v points
- units :
- m
[901000 values with dtype=float64]
- dyCuo(yh, xq)float64...
- long_name :
- Open meridional grid spacing at u points
- units :
- m
[900900 values with dtype=float64]
- wet(yh, xh)float64...
- long_name :
- land or ocean?
- units :
- nondim
[900000 values with dtype=float64]
- thetao(time, zl, yh, xh)float32dask.array<chunksize=(1, 140, 900, 1000), meta=np.ndarray>
- long_name :
- Sea Water Potential Temperature
- units :
- degC
- cell_methods :
- area:mean zl:mean yh:mean xh:mean time: mean
- time_avg_info :
- average_T1,average_T2,average_DT
- standard_name :
- sea_water_potential_temperature
Array Chunk Bytes 1.66 TB 504.00 MB Shape (3287, 140, 900, 1000) (1, 140, 900, 1000) Count 9861 Tasks 3287 Chunks Type float32 numpy.ndarray - so(time, zl, yh, xh)float32dask.array<chunksize=(1, 140, 900, 1000), meta=np.ndarray>
- long_name :
- Sea Water Salinity
- units :
- psu
- cell_methods :
- area:mean zl:mean yh:mean xh:mean time: mean
- time_avg_info :
- average_T1,average_T2,average_DT
- standard_name :
- sea_water_salinity
Array Chunk Bytes 1.66 TB 504.00 MB Shape (3287, 140, 900, 1000) (1, 140, 900, 1000) Count 9861 Tasks 3287 Chunks Type float32 numpy.ndarray - uo(time, zl, yh, xq)float32dask.array<chunksize=(1, 140, 900, 1001), meta=np.ndarray>
- long_name :
- Sea Water X Velocity
- units :
- m s-1
- cell_methods :
- zl:mean yh:mean xq:point time: mean
- time_avg_info :
- average_T1,average_T2,average_DT
- standard_name :
- sea_water_x_velocity
- interp_method :
- none
Array Chunk Bytes 1.66 TB 504.50 MB Shape (3287, 140, 900, 1001) (1, 140, 900, 1001) Count 9861 Tasks 3287 Chunks Type float32 numpy.ndarray - vo(time, zl, yq, xh)float32dask.array<chunksize=(1, 140, 901, 1000), meta=np.ndarray>
- long_name :
- Sea Water Y Velocity
- units :
- m s-1
- cell_methods :
- zl:mean yq:point xh:mean time: mean
- time_avg_info :
- average_T1,average_T2,average_DT
- standard_name :
- sea_water_y_velocity
- interp_method :
- none
Array Chunk Bytes 1.66 TB 504.56 MB Shape (3287, 140, 901, 1000) (1, 140, 901, 1000) Count 9861 Tasks 3287 Chunks Type float32 numpy.ndarray - average_T1(time)datetime64[ns]dask.array<chunksize=(1,), meta=np.ndarray>
- long_name :
- Start time for average period
Array Chunk Bytes 26.30 kB 8 B Shape (3287,) (1,) Count 9861 Tasks 3287 Chunks Type datetime64[ns] numpy.ndarray - average_T2(time)datetime64[ns]dask.array<chunksize=(1,), meta=np.ndarray>
- long_name :
- End time for average period
Array Chunk Bytes 26.30 kB 8 B Shape (3287,) (1,) Count 9861 Tasks 3287 Chunks Type datetime64[ns] numpy.ndarray - average_DT(time)timedelta64[ns]dask.array<chunksize=(1,), meta=np.ndarray>
- long_name :
- Length of average period
Array Chunk Bytes 26.30 kB 8 B Shape (3287,) (1,) Count 9861 Tasks 3287 Chunks Type timedelta64[ns] numpy.ndarray - time_bnds(time, nv)timedelta64[ns]dask.array<chunksize=(1, 2), meta=np.ndarray>
- long_name :
- time axis boundaries
- calendar :
- GREGORIAN
Array Chunk Bytes 52.59 kB 16 B Shape (3287, 2) (1, 2) Count 9861 Tasks 3287 Chunks Type timedelta64[ns] numpy.ndarray - ssh(time, yh, xh)float32dask.array<chunksize=(1, 900, 1000), meta=np.ndarray>
- long_name :
- Sea Surface Height
- units :
- m
- cell_methods :
- area:mean yh:mean xh:mean time: point
Array Chunk Bytes 11.83 GB 3.60 MB Shape (3287, 900, 1000) (1, 900, 1000) Count 19722 Tasks 3287 Chunks Type float32 numpy.ndarray - sst(time, yh, xh)float32dask.array<chunksize=(1, 900, 1000), meta=np.ndarray>
- long_name :
- Sea Surface Temperature
- units :
- degC
- cell_methods :
- area:mean yh:mean xh:mean time: point
Array Chunk Bytes 11.83 GB 3.60 MB Shape (3287, 900, 1000) (1, 900, 1000) Count 19722 Tasks 3287 Chunks Type float32 numpy.ndarray - sss(time, yh, xh)float32dask.array<chunksize=(1, 900, 1000), meta=np.ndarray>
- long_name :
- Sea Surface Salinity
- units :
- psu
- cell_methods :
- area:mean yh:mean xh:mean time: point
Array Chunk Bytes 11.83 GB 3.60 MB Shape (3287, 900, 1000) (1, 900, 1000) Count 19722 Tasks 3287 Chunks Type float32 numpy.ndarray - ssu(time, yh, xq)float32dask.array<chunksize=(1, 900, 1001), meta=np.ndarray>
- long_name :
- Sea Surface Zonal Velocity
- units :
- m s-1
- cell_methods :
- yh:mean xq:point time: point
- interp_method :
- none
Array Chunk Bytes 11.85 GB 3.60 MB Shape (3287, 900, 1001) (1, 900, 1001) Count 19722 Tasks 3287 Chunks Type float32 numpy.ndarray - ssv(time, yq, xh)float32dask.array<chunksize=(1, 901, 1000), meta=np.ndarray>
- long_name :
- Sea Surface Meridional Velocity
- units :
- m s-1
- cell_methods :
- yq:point xh:mean time: point
- interp_method :
- none
Array Chunk Bytes 11.85 GB 3.60 MB Shape (3287, 901, 1000) (1, 901, 1000) Count 19722 Tasks 3287 Chunks Type float32 numpy.ndarray - taux(time, yh, xq)float32dask.array<chunksize=(1, 900, 1001), meta=np.ndarray>
- long_name :
- Zonal surface stress from ocean interactions with atmos and ice
- units :
- Pa
- cell_methods :
- yh:mean xq:point time: point
- standard_name :
- surface_downward_x_stress
- interp_method :
- none
Array Chunk Bytes 11.85 GB 3.60 MB Shape (3287, 900, 1001) (1, 900, 1001) Count 19722 Tasks 3287 Chunks Type float32 numpy.ndarray - tauy(time, yq, xh)float32dask.array<chunksize=(1, 901, 1000), meta=np.ndarray>
- long_name :
- Meridional surface stress ocean interactions with atmos and ice
- units :
- Pa
- cell_methods :
- yq:point xh:mean time: point
- standard_name :
- surface_downward_y_stress
- interp_method :
- none
Array Chunk Bytes 11.85 GB 3.60 MB Shape (3287, 901, 1000) (1, 901, 1000) Count 19722 Tasks 3287 Chunks Type float32 numpy.ndarray - rlntds(time, yh, xh)float32dask.array<chunksize=(1, 900, 1000), meta=np.ndarray>
- long_name :
- Surface Net Downward Longwave Radiation
- units :
- W m-2
- cell_methods :
- area:mean yh:mean xh:mean time: point
- standard_name :
- surface_net_downward_longwave_flux
Array Chunk Bytes 11.83 GB 3.60 MB Shape (3287, 900, 1000) (1, 900, 1000) Count 19722 Tasks 3287 Chunks Type float32 numpy.ndarray - hflso(time, yh, xh)float32dask.array<chunksize=(1, 900, 1000), meta=np.ndarray>
- long_name :
- Surface Downward Latent Heat Flux due to Evap + Melt Snow/Ice
- units :
- W m-2
- cell_methods :
- area:mean yh:mean xh:mean time: point
- standard_name :
- surface_downward_latent_heat_flux
Array Chunk Bytes 11.83 GB 3.60 MB Shape (3287, 900, 1000) (1, 900, 1000) Count 19722 Tasks 3287 Chunks Type float32 numpy.ndarray - hfsso(time, yh, xh)float32dask.array<chunksize=(1, 900, 1000), meta=np.ndarray>
- long_name :
- Surface Downward Sensible Heat Flux
- units :
- W m-2
- cell_methods :
- area:mean yh:mean xh:mean time: point
- standard_name :
- surface_downward_sensible_heat_flux
Array Chunk Bytes 11.83 GB 3.60 MB Shape (3287, 900, 1000) (1, 900, 1000) Count 19722 Tasks 3287 Chunks Type float32 numpy.ndarray - rsntds(time, yh, xh)float32dask.array<chunksize=(1, 900, 1000), meta=np.ndarray>
- long_name :
- Net Downward Shortwave Radiation at Sea Water Surface
- units :
- W m-2
- cell_methods :
- area:mean yh:mean xh:mean time: point
- standard_name :
- net_downward_shortwave_flux_at_sea_water_surface
Array Chunk Bytes 11.83 GB 3.60 MB Shape (3287, 900, 1000) (1, 900, 1000) Count 19722 Tasks 3287 Chunks Type float32 numpy.ndarray - hfds(time, yh, xh)float32dask.array<chunksize=(1, 900, 1000), meta=np.ndarray>
- long_name :
- Surface ocean heat flux from SW+LW+latent+sensible+masstransfer+frazil+seaice_melt_heat
- units :
- W m-2
- cell_methods :
- area:mean yh:mean xh:mean time: point
- standard_name :
- surface_downward_heat_flux_in_sea_water
Array Chunk Bytes 11.83 GB 3.60 MB Shape (3287, 900, 1000) (1, 900, 1000) Count 19722 Tasks 3287 Chunks Type float32 numpy.ndarray - friver(time, yh, xh)float32dask.array<chunksize=(1, 900, 1000), meta=np.ndarray>
- long_name :
- Water Flux into Sea Water From Rivers
- units :
- kg m-2 s-1
- cell_methods :
- area:mean yh:mean xh:mean time: point
- standard_name :
- water_flux_into_sea_water_from_rivers
Array Chunk Bytes 11.83 GB 3.60 MB Shape (3287, 900, 1000) (1, 900, 1000) Count 19722 Tasks 3287 Chunks Type float32 numpy.ndarray - ssha(time, yh, xh)float32dask.array<chunksize=(1, 900, 1000), meta=np.ndarray>
- long_name :
- Sea Surface Height
- units :
- m
- cell_methods :
- area:mean yh:mean xh:mean time: point
Array Chunk Bytes 11.83 GB 3.60 MB Shape (3287, 900, 1000) (1, 900, 1000) Count 23010 Tasks 3287 Chunks Type float32 numpy.ndarray
- filename :
- ocean_daily__2010_001.nc
- title :
- MOM6 diagnostic fields table for CESM case: ETP.003
- grid_type :
- regular
- grid_tile :
- N/A
subsurf = ds.cf.sel(longitude=slice(-75), latitude=slice(0, 18)).cf.sel(
Z=100, method="nearest"
)
subsurf
<xarray.Dataset>
Dimensions: (xh: 1000, yh: 360, time: 3287, nv: 2, xq: 1001, yq: 361)
Coordinates: (12/26)
* xh (xh) float64 -125.0 -124.9 -124.9 ... -75.12 -75.07 -75.02
* yh (yh) float64 0.025 0.075 0.125 0.175 ... 17.83 17.88 17.92 17.98
zl float64 98.75
* time (time) datetime64[ns] 2009-12-30T12:00:00 ... 2018-12-29T12:0...
* nv (nv) float64 1.0 2.0
* xq (xq) float64 -125.0 -124.9 -124.9 -124.8 ... -75.1 -75.05 -75.0
... ...
dyBu (yq, xq) float64 ...
Ah (yh, xh) float64 ...
Aq (yq, xq) float64 ...
dxCvo (yq, xh) float64 ...
dyCuo (yh, xq) float64 ...
wet (yh, xh) float64 ...
Data variables: (12/22)
thetao (time, yh, xh) float32 dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
so (time, yh, xh) float32 dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
uo (time, yh, xq) float32 dask.array<chunksize=(1, 360, 1001), meta=np.ndarray>
vo (time, yq, xh) float32 dask.array<chunksize=(1, 361, 1000), meta=np.ndarray>
average_T1 (time) datetime64[ns] dask.array<chunksize=(1,), meta=np.ndarray>
average_T2 (time) datetime64[ns] dask.array<chunksize=(1,), meta=np.ndarray>
... ...
hflso (time, yh, xh) float32 dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
hfsso (time, yh, xh) float32 dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
rsntds (time, yh, xh) float32 dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
hfds (time, yh, xh) float32 dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
friver (time, yh, xh) float32 dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
ssha (time, yh, xh) float32 dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
Attributes:
filename: ocean_daily__2010_001.nc
title: MOM6 diagnostic fields table for CESM case: ETP.003
grid_type: regular
grid_tile: N/A- xh: 1000
- yh: 360
- time: 3287
- nv: 2
- xq: 1001
- yq: 361
- xh(xh)float64-125.0 -124.9 ... -75.07 -75.02
- long_name :
- h point nominal longitude
- units :
- degrees_east
- cartesian_axis :
- X
array([-124.975, -124.925, -124.875, ..., -75.125, -75.075, -75.025])
- yh(yh)float640.025 0.075 0.125 ... 17.92 17.98
- long_name :
- h point nominal latitude
- units :
- degrees_north
- cartesian_axis :
- Y
array([ 0.025, 0.075, 0.125, ..., 17.875, 17.925, 17.975])
- zl()float6498.75
- axis :
- Z
- long_name :
- Layer pseudo-depth, -z*
- units :
- meter
- cartesian_axis :
- Z
- positive :
- down
array(98.75)
- time(time)datetime64[ns]2009-12-30T12:00:00 ... 2018-12-...
array(['2009-12-30T12:00:00.000000000', '2009-12-31T12:00:00.000000000', '2010-01-01T12:00:00.000000000', ..., '2018-12-27T12:00:00.000000000', '2018-12-28T12:00:00.000000000', '2018-12-29T12:00:00.000000000'], dtype='datetime64[ns]') - nv(nv)float641.0 2.0
- long_name :
- vertex number
- units :
- none
- cartesian_axis :
- N
array([1., 2.])
- xq(xq)float64-125.0 -124.9 ... -75.05 -75.0
- long_name :
- q point nominal longitude
- units :
- degrees_east
- cartesian_axis :
- X
array([-125. , -124.95, -124.9 , ..., -75.1 , -75.05, -75. ])
- yq(yq)float640.0 0.05 0.1 ... 17.9 17.95 18.0
- long_name :
- q point nominal latitude
- units :
- degrees_north
- cartesian_axis :
- Y
array([ 0. , 0.05, 0.1 , ..., 17.9 , 17.95, 18. ])
- geolatb(yq, xq)float64...
- long_name :
- latitude at corner (Bu) points
- units :
- degree
[361361 values with dtype=float64]
- geolonb(yq, xq)float64...
- long_name :
- longitude at corner (Bu) points
- units :
- degree
[361361 values with dtype=float64]
- geolat(yh, xh)float64...
- long_name :
- latitude at tracer (T) points
- units :
- degree
[360000 values with dtype=float64]
- geolon(yh, xh)float64...
- long_name :
- longitude at tracer (T) points
- units :
- degree
[360000 values with dtype=float64]
- D(yh, xh)float64...
- long_name :
- Basin Depth
- units :
- meter
- standard_name :
- water_depth
[360000 values with dtype=float64]
- f(yq, xq)float64...
- long_name :
- Coriolis Parameter
- units :
- s-1
[361361 values with dtype=float64]
- dxCv(yq, xh)float64...
- long_name :
- Zonal grid spacing at v points
- units :
- m
[361000 values with dtype=float64]
- dyCu(yh, xq)float64...
- long_name :
- Meridional grid spacing at u points
- units :
- m
[360360 values with dtype=float64]
- dxCu(yh, xq)float64...
- long_name :
- Zonal grid spacing at u points
- units :
- m
[360360 values with dtype=float64]
- dyCv(yq, xh)float64...
- long_name :
- Meridional grid spacing at v points
- units :
- m
[361000 values with dtype=float64]
- dxT(yh, xh)float64...
- long_name :
- Zonal grid spacing at h points
- units :
- m
[360000 values with dtype=float64]
- dyT(yh, xh)float64...
- long_name :
- Meridional grid spacing at h points
- units :
- m
[360000 values with dtype=float64]
- dxBu(yq, xq)float64...
- long_name :
- Zonal grid spacing at q points
- units :
- m
[361361 values with dtype=float64]
- dyBu(yq, xq)float64...
- long_name :
- Meridional grid spacing at q points
- units :
- m
[361361 values with dtype=float64]
- Ah(yh, xh)float64...
- long_name :
- Area of h cells
- units :
- m2
[360000 values with dtype=float64]
- Aq(yq, xq)float64...
- long_name :
- Area of q cells
- units :
- m2
[361361 values with dtype=float64]
- dxCvo(yq, xh)float64...
- long_name :
- Open zonal grid spacing at v points
- units :
- m
[361000 values with dtype=float64]
- dyCuo(yh, xq)float64...
- long_name :
- Open meridional grid spacing at u points
- units :
- m
[360360 values with dtype=float64]
- wet(yh, xh)float64...
- long_name :
- land or ocean?
- units :
- nondim
[360000 values with dtype=float64]
- thetao(time, yh, xh)float32dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
- long_name :
- Sea Water Potential Temperature
- units :
- degC
- cell_methods :
- area:mean zl:mean yh:mean xh:mean time: mean
- time_avg_info :
- average_T1,average_T2,average_DT
- standard_name :
- sea_water_potential_temperature
Array Chunk Bytes 4.73 GB 1.44 MB Shape (3287, 360, 1000) (1, 360, 1000) Count 16435 Tasks 3287 Chunks Type float32 numpy.ndarray - so(time, yh, xh)float32dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
- long_name :
- Sea Water Salinity
- units :
- psu
- cell_methods :
- area:mean zl:mean yh:mean xh:mean time: mean
- time_avg_info :
- average_T1,average_T2,average_DT
- standard_name :
- sea_surface_salinity
Array Chunk Bytes 4.73 GB 1.44 MB Shape (3287, 360, 1000) (1, 360, 1000) Count 16435 Tasks 3287 Chunks Type float32 numpy.ndarray - uo(time, yh, xq)float32dask.array<chunksize=(1, 360, 1001), meta=np.ndarray>
- long_name :
- Sea Water X Velocity
- units :
- m s-1
- cell_methods :
- zl:mean yh:mean xq:point time: mean
- time_avg_info :
- average_T1,average_T2,average_DT
- standard_name :
- sea_water_x_velocity
- interp_method :
- none
Array Chunk Bytes 4.74 GB 1.44 MB Shape (3287, 360, 1001) (1, 360, 1001) Count 16435 Tasks 3287 Chunks Type float32 numpy.ndarray - vo(time, yq, xh)float32dask.array<chunksize=(1, 361, 1000), meta=np.ndarray>
- long_name :
- Sea Water Y Velocity
- units :
- m s-1
- cell_methods :
- zl:mean yq:point xh:mean time: mean
- time_avg_info :
- average_T1,average_T2,average_DT
- standard_name :
- sea_water_y_velocity
- interp_method :
- none
Array Chunk Bytes 4.75 GB 1.44 MB Shape (3287, 361, 1000) (1, 361, 1000) Count 16435 Tasks 3287 Chunks Type float32 numpy.ndarray - average_T1(time)datetime64[ns]dask.array<chunksize=(1,), meta=np.ndarray>
- long_name :
- Start time for average period
Array Chunk Bytes 26.30 kB 8 B Shape (3287,) (1,) Count 9861 Tasks 3287 Chunks Type datetime64[ns] numpy.ndarray - average_T2(time)datetime64[ns]dask.array<chunksize=(1,), meta=np.ndarray>
- long_name :
- End time for average period
Array Chunk Bytes 26.30 kB 8 B Shape (3287,) (1,) Count 9861 Tasks 3287 Chunks Type datetime64[ns] numpy.ndarray - average_DT(time)timedelta64[ns]dask.array<chunksize=(1,), meta=np.ndarray>
- long_name :
- Length of average period
Array Chunk Bytes 26.30 kB 8 B Shape (3287,) (1,) Count 9861 Tasks 3287 Chunks Type timedelta64[ns] numpy.ndarray - time_bnds(time, nv)timedelta64[ns]dask.array<chunksize=(1, 2), meta=np.ndarray>
- long_name :
- time axis boundaries
- calendar :
- GREGORIAN
Array Chunk Bytes 52.59 kB 16 B Shape (3287, 2) (1, 2) Count 9861 Tasks 3287 Chunks Type timedelta64[ns] numpy.ndarray - ssh(time, yh, xh)float32dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
- long_name :
- Sea Surface Height
- units :
- m
- cell_methods :
- area:mean yh:mean xh:mean time: point
Array Chunk Bytes 4.73 GB 1.44 MB Shape (3287, 360, 1000) (1, 360, 1000) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - sst(time, yh, xh)float32dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
- long_name :
- Sea Surface Temperature
- units :
- degC
- cell_methods :
- area:mean yh:mean xh:mean time: point
Array Chunk Bytes 4.73 GB 1.44 MB Shape (3287, 360, 1000) (1, 360, 1000) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - sss(time, yh, xh)float32dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
- long_name :
- Sea Surface Salinity
- units :
- psu
- cell_methods :
- area:mean yh:mean xh:mean time: point
Array Chunk Bytes 4.73 GB 1.44 MB Shape (3287, 360, 1000) (1, 360, 1000) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - ssu(time, yh, xq)float32dask.array<chunksize=(1, 360, 1001), meta=np.ndarray>
- long_name :
- Sea Surface Zonal Velocity
- units :
- m s-1
- cell_methods :
- yh:mean xq:point time: point
- interp_method :
- none
Array Chunk Bytes 4.74 GB 1.44 MB Shape (3287, 360, 1001) (1, 360, 1001) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - ssv(time, yq, xh)float32dask.array<chunksize=(1, 361, 1000), meta=np.ndarray>
- long_name :
- Sea Surface Meridional Velocity
- units :
- m s-1
- cell_methods :
- yq:point xh:mean time: point
- interp_method :
- none
Array Chunk Bytes 4.75 GB 1.44 MB Shape (3287, 361, 1000) (1, 361, 1000) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - taux(time, yh, xq)float32dask.array<chunksize=(1, 360, 1001), meta=np.ndarray>
- long_name :
- Zonal surface stress from ocean interactions with atmos and ice
- units :
- Pa
- cell_methods :
- yh:mean xq:point time: point
- standard_name :
- surface_downward_x_stress
- interp_method :
- none
Array Chunk Bytes 4.74 GB 1.44 MB Shape (3287, 360, 1001) (1, 360, 1001) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - tauy(time, yq, xh)float32dask.array<chunksize=(1, 361, 1000), meta=np.ndarray>
- long_name :
- Meridional surface stress ocean interactions with atmos and ice
- units :
- Pa
- cell_methods :
- yq:point xh:mean time: point
- standard_name :
- surface_downward_y_stress
- interp_method :
- none
Array Chunk Bytes 4.75 GB 1.44 MB Shape (3287, 361, 1000) (1, 361, 1000) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - rlntds(time, yh, xh)float32dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
- long_name :
- Surface Net Downward Longwave Radiation
- units :
- W m-2
- cell_methods :
- area:mean yh:mean xh:mean time: point
- standard_name :
- surface_net_downward_longwave_flux
Array Chunk Bytes 4.73 GB 1.44 MB Shape (3287, 360, 1000) (1, 360, 1000) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - hflso(time, yh, xh)float32dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
- long_name :
- Surface Downward Latent Heat Flux due to Evap + Melt Snow/Ice
- units :
- W m-2
- cell_methods :
- area:mean yh:mean xh:mean time: point
- standard_name :
- surface_downward_latent_heat_flux
Array Chunk Bytes 4.73 GB 1.44 MB Shape (3287, 360, 1000) (1, 360, 1000) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - hfsso(time, yh, xh)float32dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
- long_name :
- Surface Downward Sensible Heat Flux
- units :
- W m-2
- cell_methods :
- area:mean yh:mean xh:mean time: point
- standard_name :
- surface_downward_sensible_heat_flux
Array Chunk Bytes 4.73 GB 1.44 MB Shape (3287, 360, 1000) (1, 360, 1000) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - rsntds(time, yh, xh)float32dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
- long_name :
- Net Downward Shortwave Radiation at Sea Water Surface
- units :
- W m-2
- cell_methods :
- area:mean yh:mean xh:mean time: point
- standard_name :
- net_downward_shortwave_flux_at_sea_water_surface
Array Chunk Bytes 4.73 GB 1.44 MB Shape (3287, 360, 1000) (1, 360, 1000) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - hfds(time, yh, xh)float32dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
- long_name :
- Surface ocean heat flux from SW+LW+latent+sensible+masstransfer+frazil+seaice_melt_heat
- units :
- W m-2
- cell_methods :
- area:mean yh:mean xh:mean time: point
- standard_name :
- surface_downward_heat_flux_in_sea_water
Array Chunk Bytes 4.73 GB 1.44 MB Shape (3287, 360, 1000) (1, 360, 1000) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - friver(time, yh, xh)float32dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
- long_name :
- Water Flux into Sea Water From Rivers
- units :
- kg m-2 s-1
- cell_methods :
- area:mean yh:mean xh:mean time: point
- standard_name :
- water_flux_into_sea_water_from_rivers
Array Chunk Bytes 4.73 GB 1.44 MB Shape (3287, 360, 1000) (1, 360, 1000) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - ssha(time, yh, xh)float32dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
- long_name :
- Sea Surface Height
- units :
- m
- cell_methods :
- area:mean yh:mean xh:mean time: point
- standard_name :
- sea_surface_height_anomaly
Array Chunk Bytes 4.73 GB 1.44 MB Shape (3287, 360, 1000) (1, 360, 1000) Count 26297 Tasks 3287 Chunks Type float32 numpy.ndarray
- filename :
- ocean_daily__2010_001.nc
- title :
- MOM6 diagnostic fields table for CESM case: ETP.003
- grid_type :
- regular
- grid_tile :
- N/A
subset = ds.cf.sel(longitude=slice(-75), latitude=slice(0, 18)).cf.isel(Z=0)
subset
<xarray.Dataset>
Dimensions: (xh: 1000, yh: 360, time: 3287, nv: 2, xq: 1001, yq: 361)
Coordinates: (12/26)
* xh (xh) float64 -125.0 -124.9 -124.9 ... -75.12 -75.07 -75.02
* yh (yh) float64 0.025 0.075 0.125 0.175 ... 17.83 17.88 17.92 17.98
zl float64 1.25
* time (time) datetime64[ns] 2009-12-30T12:00:00 ... 2018-12-29T12:0...
* nv (nv) float64 1.0 2.0
* xq (xq) float64 -125.0 -124.9 -124.9 -124.8 ... -75.1 -75.05 -75.0
... ...
dyBu (yq, xq) float64 ...
Ah (yh, xh) float64 ...
Aq (yq, xq) float64 ...
dxCvo (yq, xh) float64 ...
dyCuo (yh, xq) float64 ...
wet (yh, xh) float64 ...
Data variables: (12/22)
thetao (time, yh, xh) float32 dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
so (time, yh, xh) float32 dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
uo (time, yh, xq) float32 dask.array<chunksize=(1, 360, 1001), meta=np.ndarray>
vo (time, yq, xh) float32 dask.array<chunksize=(1, 361, 1000), meta=np.ndarray>
average_T1 (time) datetime64[ns] dask.array<chunksize=(1,), meta=np.ndarray>
average_T2 (time) datetime64[ns] dask.array<chunksize=(1,), meta=np.ndarray>
... ...
hflso (time, yh, xh) float32 dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
hfsso (time, yh, xh) float32 dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
rsntds (time, yh, xh) float32 dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
hfds (time, yh, xh) float32 dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
friver (time, yh, xh) float32 dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
ssha (time, yh, xh) float32 dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
Attributes:
filename: ocean_daily__2010_001.nc
title: MOM6 diagnostic fields table for CESM case: ETP.003
grid_type: regular
grid_tile: N/A- xh: 1000
- yh: 360
- time: 3287
- nv: 2
- xq: 1001
- yq: 361
- xh(xh)float64-125.0 -124.9 ... -75.07 -75.02
- long_name :
- h point nominal longitude
- units :
- degrees_east
- cartesian_axis :
- X
array([-124.975, -124.925, -124.875, ..., -75.125, -75.075, -75.025])
- yh(yh)float640.025 0.075 0.125 ... 17.92 17.98
- long_name :
- h point nominal latitude
- units :
- degrees_north
- cartesian_axis :
- Y
array([ 0.025, 0.075, 0.125, ..., 17.875, 17.925, 17.975])
- zl()float641.25
- axis :
- Z
- long_name :
- Layer pseudo-depth, -z*
- units :
- meter
- cartesian_axis :
- Z
- positive :
- down
array(1.25)
- time(time)datetime64[ns]2009-12-30T12:00:00 ... 2018-12-...
array(['2009-12-30T12:00:00.000000000', '2009-12-31T12:00:00.000000000', '2010-01-01T12:00:00.000000000', ..., '2018-12-27T12:00:00.000000000', '2018-12-28T12:00:00.000000000', '2018-12-29T12:00:00.000000000'], dtype='datetime64[ns]') - nv(nv)float641.0 2.0
- long_name :
- vertex number
- units :
- none
- cartesian_axis :
- N
array([1., 2.])
- xq(xq)float64-125.0 -124.9 ... -75.05 -75.0
- long_name :
- q point nominal longitude
- units :
- degrees_east
- cartesian_axis :
- X
array([-125. , -124.95, -124.9 , ..., -75.1 , -75.05, -75. ])
- yq(yq)float640.0 0.05 0.1 ... 17.9 17.95 18.0
- long_name :
- q point nominal latitude
- units :
- degrees_north
- cartesian_axis :
- Y
array([ 0. , 0.05, 0.1 , ..., 17.9 , 17.95, 18. ])
- geolatb(yq, xq)float64...
- long_name :
- latitude at corner (Bu) points
- units :
- degree
[361361 values with dtype=float64]
- geolonb(yq, xq)float64...
- long_name :
- longitude at corner (Bu) points
- units :
- degree
[361361 values with dtype=float64]
- geolat(yh, xh)float64...
- long_name :
- latitude at tracer (T) points
- units :
- degree
[360000 values with dtype=float64]
- geolon(yh, xh)float64...
- long_name :
- longitude at tracer (T) points
- units :
- degree
[360000 values with dtype=float64]
- D(yh, xh)float64...
- long_name :
- Basin Depth
- units :
- meter
- standard_name :
- water_depth
[360000 values with dtype=float64]
- f(yq, xq)float64...
- long_name :
- Coriolis Parameter
- units :
- s-1
[361361 values with dtype=float64]
- dxCv(yq, xh)float64...
- long_name :
- Zonal grid spacing at v points
- units :
- m
[361000 values with dtype=float64]
- dyCu(yh, xq)float64...
- long_name :
- Meridional grid spacing at u points
- units :
- m
[360360 values with dtype=float64]
- dxCu(yh, xq)float64...
- long_name :
- Zonal grid spacing at u points
- units :
- m
[360360 values with dtype=float64]
- dyCv(yq, xh)float64...
- long_name :
- Meridional grid spacing at v points
- units :
- m
[361000 values with dtype=float64]
- dxT(yh, xh)float64...
- long_name :
- Zonal grid spacing at h points
- units :
- m
[360000 values with dtype=float64]
- dyT(yh, xh)float64...
- long_name :
- Meridional grid spacing at h points
- units :
- m
[360000 values with dtype=float64]
- dxBu(yq, xq)float64...
- long_name :
- Zonal grid spacing at q points
- units :
- m
[361361 values with dtype=float64]
- dyBu(yq, xq)float64...
- long_name :
- Meridional grid spacing at q points
- units :
- m
[361361 values with dtype=float64]
- Ah(yh, xh)float64...
- long_name :
- Area of h cells
- units :
- m2
[360000 values with dtype=float64]
- Aq(yq, xq)float64...
- long_name :
- Area of q cells
- units :
- m2
[361361 values with dtype=float64]
- dxCvo(yq, xh)float64...
- long_name :
- Open zonal grid spacing at v points
- units :
- m
[361000 values with dtype=float64]
- dyCuo(yh, xq)float64...
- long_name :
- Open meridional grid spacing at u points
- units :
- m
[360360 values with dtype=float64]
- wet(yh, xh)float64...
- long_name :
- land or ocean?
- units :
- nondim
[360000 values with dtype=float64]
- thetao(time, yh, xh)float32dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
- long_name :
- Sea Water Potential Temperature
- units :
- degC
- cell_methods :
- area:mean zl:mean yh:mean xh:mean time: mean
- time_avg_info :
- average_T1,average_T2,average_DT
- standard_name :
- sea_water_potential_temperature
Array Chunk Bytes 4.73 GB 1.44 MB Shape (3287, 360, 1000) (1, 360, 1000) Count 16435 Tasks 3287 Chunks Type float32 numpy.ndarray - so(time, yh, xh)float32dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
- long_name :
- Sea Water Salinity
- units :
- psu
- cell_methods :
- area:mean zl:mean yh:mean xh:mean time: mean
- time_avg_info :
- average_T1,average_T2,average_DT
- standard_name :
- sea_surface_salinity
Array Chunk Bytes 4.73 GB 1.44 MB Shape (3287, 360, 1000) (1, 360, 1000) Count 16435 Tasks 3287 Chunks Type float32 numpy.ndarray - uo(time, yh, xq)float32dask.array<chunksize=(1, 360, 1001), meta=np.ndarray>
- long_name :
- Sea Water X Velocity
- units :
- m s-1
- cell_methods :
- zl:mean yh:mean xq:point time: mean
- time_avg_info :
- average_T1,average_T2,average_DT
- standard_name :
- sea_water_x_velocity
- interp_method :
- none
Array Chunk Bytes 4.74 GB 1.44 MB Shape (3287, 360, 1001) (1, 360, 1001) Count 16435 Tasks 3287 Chunks Type float32 numpy.ndarray - vo(time, yq, xh)float32dask.array<chunksize=(1, 361, 1000), meta=np.ndarray>
- long_name :
- Sea Water Y Velocity
- units :
- m s-1
- cell_methods :
- zl:mean yq:point xh:mean time: mean
- time_avg_info :
- average_T1,average_T2,average_DT
- standard_name :
- sea_water_y_velocity
- interp_method :
- none
Array Chunk Bytes 4.75 GB 1.44 MB Shape (3287, 361, 1000) (1, 361, 1000) Count 16435 Tasks 3287 Chunks Type float32 numpy.ndarray - average_T1(time)datetime64[ns]dask.array<chunksize=(1,), meta=np.ndarray>
- long_name :
- Start time for average period
Array Chunk Bytes 26.30 kB 8 B Shape (3287,) (1,) Count 9861 Tasks 3287 Chunks Type datetime64[ns] numpy.ndarray - average_T2(time)datetime64[ns]dask.array<chunksize=(1,), meta=np.ndarray>
- long_name :
- End time for average period
Array Chunk Bytes 26.30 kB 8 B Shape (3287,) (1,) Count 9861 Tasks 3287 Chunks Type datetime64[ns] numpy.ndarray - average_DT(time)timedelta64[ns]dask.array<chunksize=(1,), meta=np.ndarray>
- long_name :
- Length of average period
Array Chunk Bytes 26.30 kB 8 B Shape (3287,) (1,) Count 9861 Tasks 3287 Chunks Type timedelta64[ns] numpy.ndarray - time_bnds(time, nv)timedelta64[ns]dask.array<chunksize=(1, 2), meta=np.ndarray>
- long_name :
- time axis boundaries
- calendar :
- GREGORIAN
Array Chunk Bytes 52.59 kB 16 B Shape (3287, 2) (1, 2) Count 9861 Tasks 3287 Chunks Type timedelta64[ns] numpy.ndarray - ssh(time, yh, xh)float32dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
- long_name :
- Sea Surface Height
- units :
- m
- cell_methods :
- area:mean yh:mean xh:mean time: point
Array Chunk Bytes 4.73 GB 1.44 MB Shape (3287, 360, 1000) (1, 360, 1000) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - sst(time, yh, xh)float32dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
- long_name :
- Sea Surface Temperature
- units :
- degC
- cell_methods :
- area:mean yh:mean xh:mean time: point
Array Chunk Bytes 4.73 GB 1.44 MB Shape (3287, 360, 1000) (1, 360, 1000) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - sss(time, yh, xh)float32dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
- long_name :
- Sea Surface Salinity
- units :
- psu
- cell_methods :
- area:mean yh:mean xh:mean time: point
Array Chunk Bytes 4.73 GB 1.44 MB Shape (3287, 360, 1000) (1, 360, 1000) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - ssu(time, yh, xq)float32dask.array<chunksize=(1, 360, 1001), meta=np.ndarray>
- long_name :
- Sea Surface Zonal Velocity
- units :
- m s-1
- cell_methods :
- yh:mean xq:point time: point
- interp_method :
- none
Array Chunk Bytes 4.74 GB 1.44 MB Shape (3287, 360, 1001) (1, 360, 1001) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - ssv(time, yq, xh)float32dask.array<chunksize=(1, 361, 1000), meta=np.ndarray>
- long_name :
- Sea Surface Meridional Velocity
- units :
- m s-1
- cell_methods :
- yq:point xh:mean time: point
- interp_method :
- none
Array Chunk Bytes 4.75 GB 1.44 MB Shape (3287, 361, 1000) (1, 361, 1000) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - taux(time, yh, xq)float32dask.array<chunksize=(1, 360, 1001), meta=np.ndarray>
- long_name :
- Zonal surface stress from ocean interactions with atmos and ice
- units :
- Pa
- cell_methods :
- yh:mean xq:point time: point
- standard_name :
- surface_downward_x_stress
- interp_method :
- none
Array Chunk Bytes 4.74 GB 1.44 MB Shape (3287, 360, 1001) (1, 360, 1001) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - tauy(time, yq, xh)float32dask.array<chunksize=(1, 361, 1000), meta=np.ndarray>
- long_name :
- Meridional surface stress ocean interactions with atmos and ice
- units :
- Pa
- cell_methods :
- yq:point xh:mean time: point
- standard_name :
- surface_downward_y_stress
- interp_method :
- none
Array Chunk Bytes 4.75 GB 1.44 MB Shape (3287, 361, 1000) (1, 361, 1000) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - rlntds(time, yh, xh)float32dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
- long_name :
- Surface Net Downward Longwave Radiation
- units :
- W m-2
- cell_methods :
- area:mean yh:mean xh:mean time: point
- standard_name :
- surface_net_downward_longwave_flux
Array Chunk Bytes 4.73 GB 1.44 MB Shape (3287, 360, 1000) (1, 360, 1000) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - hflso(time, yh, xh)float32dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
- long_name :
- Surface Downward Latent Heat Flux due to Evap + Melt Snow/Ice
- units :
- W m-2
- cell_methods :
- area:mean yh:mean xh:mean time: point
- standard_name :
- surface_downward_latent_heat_flux
Array Chunk Bytes 4.73 GB 1.44 MB Shape (3287, 360, 1000) (1, 360, 1000) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - hfsso(time, yh, xh)float32dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
- long_name :
- Surface Downward Sensible Heat Flux
- units :
- W m-2
- cell_methods :
- area:mean yh:mean xh:mean time: point
- standard_name :
- surface_downward_sensible_heat_flux
Array Chunk Bytes 4.73 GB 1.44 MB Shape (3287, 360, 1000) (1, 360, 1000) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - rsntds(time, yh, xh)float32dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
- long_name :
- Net Downward Shortwave Radiation at Sea Water Surface
- units :
- W m-2
- cell_methods :
- area:mean yh:mean xh:mean time: point
- standard_name :
- net_downward_shortwave_flux_at_sea_water_surface
Array Chunk Bytes 4.73 GB 1.44 MB Shape (3287, 360, 1000) (1, 360, 1000) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - hfds(time, yh, xh)float32dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
- long_name :
- Surface ocean heat flux from SW+LW+latent+sensible+masstransfer+frazil+seaice_melt_heat
- units :
- W m-2
- cell_methods :
- area:mean yh:mean xh:mean time: point
- standard_name :
- surface_downward_heat_flux_in_sea_water
Array Chunk Bytes 4.73 GB 1.44 MB Shape (3287, 360, 1000) (1, 360, 1000) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - friver(time, yh, xh)float32dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
- long_name :
- Water Flux into Sea Water From Rivers
- units :
- kg m-2 s-1
- cell_methods :
- area:mean yh:mean xh:mean time: point
- standard_name :
- water_flux_into_sea_water_from_rivers
Array Chunk Bytes 4.73 GB 1.44 MB Shape (3287, 360, 1000) (1, 360, 1000) Count 23009 Tasks 3287 Chunks Type float32 numpy.ndarray - ssha(time, yh, xh)float32dask.array<chunksize=(1, 360, 1000), meta=np.ndarray>
- long_name :
- Sea Surface Height
- units :
- m
- cell_methods :
- area:mean yh:mean xh:mean time: point
- standard_name :
- sea_surface_height_anomaly
Array Chunk Bytes 4.73 GB 1.44 MB Shape (3287, 360, 1000) (1, 360, 1000) Count 26297 Tasks 3287 Chunks Type float32 numpy.ndarray
- filename :
- ocean_daily__2010_001.nc
- title :
- MOM6 diagnostic fields table for CESM case: ETP.003
- grid_type :
- regular
- grid_tile :
- N/A
clean = subset.reset_coords("D")[["so", "ssha", "D"]].reset_coords(drop=True)
grid = xgcm_grid_mom6(subset)
clean["tauy"] = grid.interp(subset.tauy, axis="Y")
clean["taux"] = grid.interp(subset.taux, axis="X")
render(clean.isel(time=330))
def wrapper(subset, framedim=None):
mpl.use("agg")
render(subset, framedim)
fig.savefig(
f"../movies/sss_obs/{subset['time'].data}.png", dpi=300, bbox_inches="tight"
)
plt.close(fig)
return subset["time"].expand_dims("time")
clean.map_blocks(
wrapper,
kwargs={"framedim": "time"},
template=xr.ones_like(ds["time"]).chunk({"time": 1}),
).compute(scheduler=client)
<xarray.DataArray 'time' (time: 6940)>
array(['1999-12-30T12:00:00.000000000', '1999-12-31T12:00:00.000000000',
'2000-01-01T12:00:00.000000000', ...,
'2018-12-27T12:00:00.000000000', '2018-12-28T12:00:00.000000000',
'2018-12-29T12:00:00.000000000'], dtype='datetime64[ns]')
Coordinates:
* time (time) datetime64[ns] 1999-12-30T12:00:00 ... 2018-12-29T12:00:00- time: 6940
- 1999-12-30T12:00:00 1999-12-31T12:00:00 ... 2018-12-29T12:00:00
array(['1999-12-30T12:00:00.000000000', '1999-12-31T12:00:00.000000000', '2000-01-01T12:00:00.000000000', ..., '2018-12-27T12:00:00.000000000', '2018-12-28T12:00:00.000000000', '2018-12-29T12:00:00.000000000'], dtype='datetime64[ns]') - time(time)datetime64[ns]1999-12-30T12:00:00 ... 2018-12-...
array(['1999-12-30T12:00:00.000000000', '1999-12-31T12:00:00.000000000', '2000-01-01T12:00:00.000000000', ..., '2018-12-27T12:00:00.000000000', '2018-12-28T12:00:00.000000000', '2018-12-29T12:00:00.000000000'], dtype='datetime64[ns]')
Obs plots¶
sss = xr.open_dataset(
"/glade/work/dcherian/datasets/oisss_merged.zarr",
engine="zarr",
consolidated=True,
chunks="auto",
)
topo = xr.open_dataset("/glade/u/home/dcherian/datasets/ETOPO2v2g_f4.nc4").sel(
y=slice(0, 18), x=slice(-125, -75)
)
topo["z"].attrs["standard_name"] = "water_depth"
topo = (topo * -1).where(topo < 0)
topo["x"].attrs["units"] = "degrees_east"
topo["y"].attrs["units"] = "degrees_north"
ssh = xr.open_mfdataset(
"/glade/u/home/dcherian/datasets/ssh/ssh_grids*.nc",
parallel=True,
data_vars="minimal",
coords="minimal",
compat="override",
decode_coords="all",
)
ssh["Longitude"] = ssh.Longitude - 360
ssh["Longitude"].attrs["bounds"] = "Lon_bounds"
ssh["Latitude"].attrs["bounds"] = "Lat_bounds"
ssh.SLA.attrs["coordinates"] = "Time Latitude Longitude"
ssh = ssh.sel(Time=slice(sss.time[0].data, sss.time[-1].data))
/glade/u/home/dcherian/python/xarray/xarray/coding/times.py:119: SerializationWarning: Ambiguous reference date string: 1-1-1 00:00:0.0. The first value is assumed to be the year hence will be padded with zeros to remove the ambiguity (the padded reference date string is: 0001-1-1 00:00:0.0). To remove this message, remove the ambiguity by padding your reference date strings with zeros.
warnings.warn(warning_msg, SerializationWarning)
ssh
<xarray.Dataset>
Dimensions: (Longitude: 2160, nv: 2, Latitude: 960, Time: 541)
Coordinates:
Lon_bounds (Longitude, nv) float32 dask.array<chunksize=(2160, 2), meta=np.ndarray>
* Longitude (Longitude) float32 -359.9 -359.8 -359.6 ... -0.25 -0.08334
Lat_bounds (Latitude, nv) float32 dask.array<chunksize=(960, 2), meta=np.ndarray>
* Latitude (Latitude) float32 -79.92 -79.75 -79.58 ... 79.58 79.75 79.92
* Time (Time) datetime64[ns] 2011-08-29T12:00:00 ... 2019-01-24T12:...
Time_bounds (Time, nv) datetime64[ns] dask.array<chunksize=(1, 2), meta=np.ndarray>
Dimensions without coordinates: nv
Data variables:
SLA (Time, Longitude, Latitude) float32 dask.array<chunksize=(1, 2160, 960), meta=np.ndarray>
SLA_ERR (Time, Longitude, Latitude) float32 dask.array<chunksize=(1, 2160, 960), meta=np.ndarray>
Attributes: (12/15)
Conventions: CF-1.6
ncei_template_version: NCEI_NetCDF_Grid_Template_v2.0
Institution: Jet Propulsion Laboratory
geospatial_lat_min: -79.916664
geospatial_lat_max: 79.916664
geospatial_lon_min: 0.083333336
... ...
date_created: 2019-02-11T20:19:58.910660
version_number: 1812
summary: Sea level anomaly grids from altimeter d...
title: Sea Level Anormaly Estimate based on Alt...
DODS_EXTRA.Unlimited_Dimension: Time
history: 2021-07-02 17:17:58 GMT Hyrax-1.16.0 htt...- Longitude: 2160
- nv: 2
- Latitude: 960
- Time: 541
- Lon_bounds(Longitude, nv)float32dask.array<chunksize=(2160, 2), meta=np.ndarray>
- units :
- degrees_east
- comment :
- longitude values at the west and east bounds of each pixel.
Array Chunk Bytes 17.28 kB 17.28 kB Shape (2160, 2) (2160, 2) Count 2 Tasks 1 Chunks Type float32 numpy.ndarray - Longitude(Longitude)float32-359.9 -359.8 ... -0.25 -0.08334
- standard_name :
- longitude
- units :
- degrees_east
- point_spacing :
- even
- long_name :
- longitude
- axis :
- X
- bounds :
- Lon_bounds
array([-3.599167e+02, -3.597500e+02, -3.595833e+02, ..., -4.166565e-01, -2.500000e-01, -8.334351e-02], dtype=float32) - Lat_bounds(Latitude, nv)float32dask.array<chunksize=(960, 2), meta=np.ndarray>
- units :
- degrees_north
- comment :
- latitude values at the north and south bounds of each pixel.
Array Chunk Bytes 7.68 kB 7.68 kB Shape (960, 2) (960, 2) Count 2 Tasks 1 Chunks Type float32 numpy.ndarray - Latitude(Latitude)float32-79.92 -79.75 ... 79.75 79.92
- standard_name :
- latitude
- units :
- degrees_north
- point_spacing :
- even
- long_name :
- latitude
- axis :
- Y
- bounds :
- Lat_bounds
array([-79.916664, -79.75 , -79.583336, ..., 79.583336, 79.75 , 79.916664], dtype=float32) - Time(Time)datetime64[ns]2011-08-29T12:00:00 ... 2019-01-...
- standard_name :
- time
- long_name :
- Time
- axis :
- T
array(['2011-08-29T12:00:00.000000000', '2011-09-03T12:00:00.000000000', '2011-09-08T12:00:00.000000000', ..., '2019-01-14T12:00:00.000000000', '2019-01-19T12:00:00.000000000', '2019-01-24T12:00:00.000000000'], dtype='datetime64[ns]') - Time_bounds(Time, nv)datetime64[ns]dask.array<chunksize=(1, 2), meta=np.ndarray>
- comment :
- Time bounds for each time value, same value as time variable. The time variable is defined on points instead of on bounding boxes.
Array Chunk Bytes 8.66 kB 16 B Shape (541, 2) (1, 2) Count 6304 Tasks 541 Chunks Type datetime64[ns] numpy.ndarray
- SLA(Time, Longitude, Latitude)float32dask.array<chunksize=(1, 2160, 960), meta=np.ndarray>
- units :
- m
- long_name :
- Sea Level Anomaly Estimate
- standard_name :
- sea_surface_height_above_sea_level
- alias :
- sea_surface_height_above_sea_level
- coordinates :
- Time Latitude Longitude
Array Chunk Bytes 4.49 GB 8.29 MB Shape (541, 2160, 960) (1, 2160, 960) Count 6304 Tasks 541 Chunks Type float32 numpy.ndarray - SLA_ERR(Time, Longitude, Latitude)float32dask.array<chunksize=(1, 2160, 960), meta=np.ndarray>
- units :
- m
- long_name :
- Sea Level Anomaly Error Estimate
Array Chunk Bytes 4.49 GB 8.29 MB Shape (541, 2160, 960) (1, 2160, 960) Count 6304 Tasks 541 Chunks Type float32 numpy.ndarray
- Conventions :
- CF-1.6
- ncei_template_version :
- NCEI_NetCDF_Grid_Template_v2.0
- Institution :
- Jet Propulsion Laboratory
- geospatial_lat_min :
- -79.916664
- geospatial_lat_max :
- 79.916664
- geospatial_lon_min :
- 0.083333336
- geospatial_lon_max :
- 359.91666
- time_coverage_start :
- 1992-10-07
- time_coverage_end :
- 1992-10-07
- date_created :
- 2019-02-11T20:19:58.910660
- version_number :
- 1812
- summary :
- Sea level anomaly grids from altimeter data using Kriging interpolation, which gives best linear prediction based upon prior knowledge of covariance.
- title :
- Sea Level Anormaly Estimate based on Altimeter Data
- DODS_EXTRA.Unlimited_Dimension :
- Time
- history :
- 2021-07-02 17:17:58 GMT Hyrax-1.16.0 https://podaac-opendap.jpl.nasa.gov/opendap/allData/merged_alt/L4/cdr_grid/ssh_grids_v1812_1992100712.nc.nc?Lon_bounds[0:1:2159][0:1:1],Longitude[0:1:2159],Lat_bounds[0:1:959][0:1:1],Latitude[0:1:959],Time[0:1:0],Time_bounds[0:1:0][0:1:1],SLA[0:1:0][0:1:2159][0:1:959],SLA_ERR[0:1:0][0:1:2159][0:1:959]
with dask.config.set(**{"array.slicing.split_large_chunks": True}):
obs = xr.merge(
[
sss.sss.reindex(time=ssh.Time.data, method="nearest")
.rename({"time": "Time"})
.chunk({"Time": 1}),
ssh.SLA,
topo.z,
]
)
obs.sss.attrs["standard_name"] = "sea_surface_salinity"
obs.SLA.attrs["standard_name"] = "sea_surface_height_anomaly"
subset_obs = obs.cf.sel(longitude=slice(-125, -75), latitude=slice(0, 18))
render(subset_obs.isel(Time=19));
def render(subset, fig=None, ax=None, framedim=None, add_colorbar=True):
import cf_xarray
import matplotlib as mpl
import matplotlib.pyplot as plt
if framedim is not None and subset.sizes[framedim] > 1:
subset = subset.isel({framedim: 0})
subset = subset.squeeze()
plt.rcParams["font.size"] = 10
if ax is None and fig is None:
fig = plt.figure()
ax = fig.subplots(1, 1)
elif ax is not None:
fig = ax.get_figure()
if isinstance(subset, xr.DataArray):
subset = subset.to_dataset(dim="variable")
if add_colorbar:
cbar_kwargs = {
"orientation": "horizontal",
"aspect": 30,
"shrink": 0.8,
"extend": "neither",
}
else:
cbar_kwargs = None
subset.cf["sea_surface_salinity"].cf.plot(
robust=True,
cmap=cmo.cm.haline,
vmin=32,
vmax=34.5,
ax=ax,
add_colorbar=add_colorbar,
cbar_kwargs=cbar_kwargs,
)
subset.cf["sea_surface_salinity"].cf.plot.contour(
levels=[33, 34],
colors=["coral", "red"],
ax=ax,
linewidths=0.75,
)
if "water_depth" in subset.cf:
subset.cf["water_depth"].plot.contour(
colors="w", linewidths=0.25, levels=[1000, 2000, 3000, 4000], ax=ax
)
subset.cf["sea_surface_height_anomaly"].cf.plot.contour(
colors="k",
levels=[-0.25, -0.2, -0.15, -0.1, 0, 0.1, 0.15, 0.2, 0.25],
linewidths=0.5,
ax=ax,
)
if "taux" in subset:
coastal_mask = (
np.isnan(subset.taux.shift(xh=-1))
| np.isnan(subset.taux.shift(yh=-1)) & (subset.yh < 19)
# | np.isnan(subset.taux.shift(xh=1))
# | np.isnan(subset.taux.shift(yh=1))
)
(
subset.where(coastal_mask)
.shift(xh=15, yh=15)
.plot.quiver(
x="xh",
y="yh",
u="taux",
v="tauy",
scale=2,
color="k",
pivot="tail",
ax=ax,
)
)
ax.plot(-100, 12, marker="o", markersize=8, color="w")
ax.plot(-100, 12, marker="o", markersize=5, color="k")
ax.set_xlabel("")
ax.set_ylabel("")
return fig
def wrapper_model_and_obs(model, obs, framedim=None):
mpl.use("agg")
fig, axes = plt.subplots(2, 1, sharex=True, sharey=True, constrained_layout=True)
fig.set_size_inches((6, 6))
render(model, ax=axes[0], add_colorbar=False, framedim=framedim)
render(obs, ax=axes[1], framedim=framedim)
axes[1].set_title("")
# plt.tight_layout()
fig.savefig(
f"../movies/sss_obs/{obs[framedim].squeeze().data}.png",
dpi=200,
bbox_inches="tight",
)
plt.close(fig)
return obs[framedim] # .expand_dims(framedim)
cluster.close()
wrapper_model_and_obs(
model=clean.sel(time=subset_obs.Time.data, method="nearest")
.rename({"time": "Time"})
.isel(Time=10),
obs=subset_obs.isel(Time=10),
)
model = clean.rename({"time": "Time"}).sel(
Time=slice(subset_obs.Time[0].data, subset_obs.Time[-1].data)
)
frames = xr.map_blocks(
wrapper_model_and_obs,
model,
args=(
subset_obs.reindex(Time=model.Time.data, method="nearest").chunk({"Time": 1}),
),
kwargs={"framedim": "Time"},
template=xr.ones_like(model["Time"]).chunk({"Time": 1}),
)
cluster.scale(24)
frames.compute()
<xarray.DataArray 'Time' (Time: 2680)>
array(['2011-08-29T12:00:00.000000000', '2011-08-30T12:00:00.000000000',
'2011-08-31T12:00:00.000000000', ...,
'2018-12-27T12:00:00.000000000', '2018-12-28T12:00:00.000000000',
'2018-12-29T12:00:00.000000000'], dtype='datetime64[ns]')
Coordinates:
* Time (Time) datetime64[ns] 2011-08-29T12:00:00 ... 2018-12-29T12:00:00- Time: 2680
- 2011-08-29T12:00:00 2011-08-30T12:00:00 ... 2018-12-29T12:00:00
array(['2011-08-29T12:00:00.000000000', '2011-08-30T12:00:00.000000000', '2011-08-31T12:00:00.000000000', ..., '2018-12-27T12:00:00.000000000', '2018-12-28T12:00:00.000000000', '2018-12-29T12:00:00.000000000'], dtype='datetime64[ns]') - Time(Time)datetime64[ns]2011-08-29T12:00:00 ... 2018-12-...
array(['2011-08-29T12:00:00.000000000', '2011-08-30T12:00:00.000000000', '2011-08-31T12:00:00.000000000', ..., '2018-12-27T12:00:00.000000000', '2018-12-28T12:00:00.000000000', '2018-12-29T12:00:00.000000000'], dtype='datetime64[ns]')
subsurface¶
cleansub = subsurf.reset_coords("D")[["so", "ssha", "D"]].reset_coords(drop=True)
grid = xgcm_grid_mom6(subset)
cleansub["tauy"] = grid.interp(subset.tauy, axis="Y")
cleansub["taux"] = grid.interp(subset.taux, axis="X")
Old stuff¶
xmovie¶
import xmovie
movie = xmovie.Movie(clean.to_array(dim="variable"), vmin=10, vmax=20, plotfunc=render)
movie.preview(10)
interactive slider¶
slider = pnw.IntSlider(name="time", start=0, end=subset.sizes["time"])
subset.interactive.isel(time=slider).pipe(render)
bokeh¶
subset["so"] = subset.so.persist()
subset["ssha"] = subset.ssha.persist()
##kwargs = dict(x="xh", y="yh", groupby="time")
salt = subset.so.hvplot.image(**kwargs, cmap="magma", clim=(32, 34.5))
depth = subset.D.reset_coords(drop=True).hvplot.contour(x="xh", y="yh", cmap=["white"])
ssha = subset.ssha.reset_coords(drop=True).hvplot.contour(
**kwargs, levels=(-0.2, -0.15, -0.1, 0.1, 0.15, 0.2), cmap=["black"]
)
(salt * depth * ssha)
Download OISSS data¶
import xarray as xr
ds = xr.open_dataset(
"http://apdrc.soest.hawaii.edu:80/dods/public_data/satellite_product/OISSS/Aquarius_SMAP_OISSS_L4_multimission_global_7d_v1.0",
engine="netcdf4",
chunks={"time": 30},
decode_times=False,
)
ds
<xarray.Dataset>
Dimensions: (time: 872, lat: 720, lon: 1440)
Coordinates:
* time (time) float64 7.344e+05 7.344e+05 ... 7.379e+05 7.379e+05
* lat (lat) float64 -89.88 -89.62 -89.38 ... 89.38 89.62 89.88
* lon (lon) float64 -179.9 -179.6 -179.4 ... 179.4 179.6 179.9
Data variables:
sss (time, lat, lon) float32 dask.array<chunksize=(30, 720, 1440), meta=np.ndarray>
sss_uncertainty (time, lat, lon) float32 dask.array<chunksize=(30, 720, 1440), meta=np.ndarray>
Attributes:
title: Multi-Mission OISSS 7-Day Global Dataset V1.0
Conventions: COARDS\nGrADS
dataType: Grid
documentation: http://apdrc.soest.hawaii.edu/datadoc/oisss_multi.php
history: Thu Jul 01 10:54:37 HST 2021 : imported by GrADS Data Ser...- time: 872
- lat: 720
- lon: 1440
- time(time)float647.344e+05 7.344e+05 ... 7.379e+05
- grads_dim :
- t
- grads_mapping :
- linear
- grads_size :
- 872
- grads_min :
- 00z28aug2011
- grads_step :
- 4dy
- units :
- days since 1-1-1 00:00:0.0
- long_name :
- time
- minimum :
- 00z28aug2011
- maximum :
- 00z12mar2021
- resolution :
- 4.0
array([734378., 734382., 734386., ..., 737854., 737858., 737862.])
- lat(lat)float64-89.88 -89.62 ... 89.62 89.88
- grads_dim :
- y
- grads_mapping :
- linear
- grads_size :
- 720
- units :
- degrees_north
- long_name :
- latitude
- minimum :
- -89.875
- maximum :
- 89.875
- resolution :
- 0.25
array([-89.875, -89.625, -89.375, ..., 89.375, 89.625, 89.875])
- lon(lon)float64-179.9 -179.6 ... 179.6 179.9
- grads_dim :
- x
- grads_mapping :
- linear
- grads_size :
- 1440
- units :
- degrees_east
- long_name :
- longitude
- minimum :
- -179.875
- maximum :
- 179.875
- resolution :
- 0.25
array([-179.875, -179.625, -179.375, ..., 179.375, 179.625, 179.875])
- sss(time, lat, lon)float32dask.array<chunksize=(30, 720, 1440), meta=np.ndarray>
- long_name :
- sea surface salinity [1e-3]
Array Chunk Bytes 3.62 GB 124.42 MB Shape (872, 720, 1440) (30, 720, 1440) Count 31 Tasks 30 Chunks Type float32 numpy.ndarray - sss_uncertainty(time, lat, lon)float32dask.array<chunksize=(30, 720, 1440), meta=np.ndarray>
- long_name :
- estimated empirical uncertainty of multi-mission oisss [1e-3]
Array Chunk Bytes 3.62 GB 124.42 MB Shape (872, 720, 1440) (30, 720, 1440) Count 31 Tasks 30 Chunks Type float32 numpy.ndarray
- title :
- Multi-Mission OISSS 7-Day Global Dataset V1.0
- Conventions :
- COARDS GrADS
- dataType :
- Grid
- documentation :
- http://apdrc.soest.hawaii.edu/datadoc/oisss_multi.php
- history :
- Thu Jul 01 10:54:37 HST 2021 : imported by GrADS Data Server 2.0
cluster.scale(8)
ds = ds.persist()
ds.to_zarr("~/datasets/oisss_merged.zarr", consolidated=True)
<xarray.backends.zarr.ZarrStore at 0x2b229f660430>
import cf_xarray